/*
 * Copyright 2010 - Jeremie Brebec
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package org.jb.coinche.client.business.model;

import org.jb.coinche.client.business.model.Player.Team;
import org.jb.statemachine.client.AbstractState;

public class Round extends AbstractState implements GameState {

	/**
	 * 
	 */
	private static final long serialVersionUID = 295813343156329511L;
	/**
	 * @param auction the auction to set
	 */
	public void setAuction(Auction auction) {
		this.auction = auction;
	}

	/**
	 * @return the auction
	 */
	public Auction getAuction() {
		return auction;
	}
	
	/**
	 * @param game the game to set
	 */
	public void setGame(Game game) {
		this.game = game;
	}

	/**
	 * @return the game
	 */
	public Game getGame() {
		return game;
	}
	
	/*
	 * 
	 */
	public void addScoreDixDeDer(Team team) {
		if (team == Player.Team.T1) {
			team1_score += 10;
		} else {
			team2_score += 10;
		}
		
	}
	
	/*
	 * 
	 */
	public void addScore( Player.Team team, int score ) {
		if (team == Player.Team.T1) {
			team1_score += score;
		} else {
			team2_score += score;
		}
	}
	
	/*
	 * 
	 */
	public int getScore( Player.Team team ) {
		if (team == Player.Team.T1) {
			return team1_score;
		} else {
			return team2_score;
		}
	}
	
	/*
	 * 
	 */
	public int getScore1() {
		return team1_score;
	}
	
	public int getScore2() {
		return team2_score;
	}
		
	/*
	 * 
	 */
	public boolean isFinished() {
		return game.getPlayers().get(0).getCards().isEmpty();
	}
	
	private Auction auction;
	private Game game;
	private int team1_score = 0;
	private int team2_score = 0;
	
}
